<%@ page import="question.QuestionInfo" %>
<%@ page import="com.opensymphony.xwork2.util.ValueStack" %>
<%@ page import="java.util.List" %>
<%@ page import="utils.Var" %>
<%@ page import="question.ClassifyInfo" %>
<%@ page import="java.util.Map" %>
<%@ page import="question.QuestionUtils" %>
<%@ page import="question.QuestionVar" %>
<%@ page import="utils.TextUtils" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
  <title></title>
  <link href="../../skin/default/global.css" rel="stylesheet" type="text/css"/>
  <link href="../../skin/default/layout.css" rel="stylesheet" type="text/css"/>
   <style>
    	html,body{overflow-x:hidden}
    </style>
</head>
<%
  ValueStack vs = (ValueStack) request.getAttribute("struts.valueStack");
  List<QuestionInfo> list = (List<QuestionInfo>) vs.findValue("qlist");
  Map<Integer, ClassifyInfo> cmap = (Map<Integer, ClassifyInfo>) vs.findValue("cmap");

  int cid = (Integer) vs.findValue("cid");
  int p = (Integer) vs.findValue("page");
  long ps = (Long) vs.findValue("pageSum");
%>
<body class="admin-content admin-panel-body">
<!--<div class="icon" id="manage"></div>-->

<!--<h1 class="title manage">客运/道路运输法规/旅客运输经营基本规定（<span>共172道题</span>）</h1>-->

<!--<div class="admin-tablenav" style="margin-bottom:-15px;">
  <button type="button" class="normal"><span></span>批量删除</button>
  <button type="button" class="blue" onclick="kswindow.open({title:'添加题目',url:'question.jsp'})"><span></span>添加题目</button>
</div>-->

<!--通过率列表-->
<table cellpadding="0" cellspacing="0" class="admin-table" style="width:98%">
  <thead>
    <tr>
      <!--<th style="width:30px"><span class="first"></span>
        <input type="checkbox" style="margin-left:5px; margin-bottom:-1px;"/>
      </th>-->
      <th style="width:30px"><span class="first"></span>编码</th>
      <th style="width:170px;">考试要点</th>
      <th>试题内容</th>
      <th style="width:30px">题型</th>
      <th style="width:30px">答案</th>
      <th style="width:30px">分值</th>
      <th style="width:30px">重点</th>
      <th style="width:30px">难易</th>
      <th style="width:50px;" class="last">其他</th>
    </tr>
  </thead>
  <tbody id="managelist">
    <%
      if(list.size() == 0){
    %>
    <tr>
      <td colspan="10" class="first last">
        <div class="notice">题库列表为空</div>
      </td>
    </tr>
    <%
      }

      long index = (p - 1) * Var.PAGE_LENGTH + 1;
      for(QuestionInfo info : list){
    %>
    <tr>
      <!--<td class="first"><input type="checkbox"/></td>-->
      <td class="first"><%=index ++%></td>
      <td style="width:170px"><%=TextUtils.html(cmap.get(info.getCid()).getCname())%></td>
      <td><%=TextUtils.html(info.getContent())%></td>
      <td><%=QuestionUtils.getTx(info.getTx())%></td>
      <td><%=QuestionUtils.getAnswer(info.getTx(), info.getAnswer())%></td>
      <td><%=0%></td>
      <td><%=info.getImportant() == 1 ? "是" : "否"%></td>
      <td><%=QuestionUtils.getComplexity(info.getComplexity())%></td>
      <td class="last"><%=info.getType() == QuestionVar.TYPE_EXAM ? "考试" : "练习"%></td>
    </tr>
    <%
      }
    %>
  </tbody>
  <tfoot>
    <tr>
      <td colspan="10" class="last"><span class="first"></span>

        <a href="queryQuestion.action?cid=<%=cid%>">首页</a> |
        <a href="<%=p == 1 ? "#" : "queryQuestion.action?cid=" + cid + "&page=" + (p - 1)%>">上一页</a> |
        <a href="<%=p == ps ? "#" : "queryQuestion.action?cid=" + cid + "&page=" + (p + 1)%>">下一页</a> |
        <a href="queryQuestion.action?cid=<%=cid%>&page=<%=ps%>">末页</a>

        <select onchange="location.href='queryQuestion.action?cid=<%=cid%>&page='+this.value">
          <%
            for(int i = 1; i <= ps; i++){
          %>
          <option value="<%=i%>" <%=p == i ? "selected":""%>><%=i%></option>
          <%
            }
          %>
        </select>
      </td>
    </tr>
  </tfoot>
</table>


<script src="../../common/jquery-1.3.2.min.js"></script>
<script src="../../common/fun.js"></script>
<script>
  $(function() {
    list = new KS.List("managelist", true)
    kswindow = new KS.Window();
  })
</script>
</body>

</html>